import { strictEqual } from 'assert';
import { Mock } from 'lite-ts-mock';
import { TreePSD } from 'psd';

import { ToggleContainer } from './cc';
import { TabConverter as Self } from './tab';
import { ConverterFactoryBase } from '../../contract';

describe('src/scene/service/converter/tab.ts', () => {
    describe('.convert()', () => {
        it('ok', async () => {
            const mockConverterFactory = new Mock<ConverterFactoryBase>();
            const mockTreePSD = new Mock<TreePSD>();
            const self = new Self(null as any, mockConverterFactory.actual, null as any, mockTreePSD.actual);

            const node = 'node';
            Reflect.set(self, 'createNode', () => {
                return node;
            });

            Reflect.set(self, 'addChildren', (arg: any) => {
                strictEqual(arg, node);
            });

            Reflect.set(self, 'appendComponent', (arg: any, arg1: any) => {
                strictEqual(arg, ToggleContainer);
                strictEqual(arg1, node);
            });

            const res = await self.convert();
            strictEqual(res, node);
        });
    });
});